<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" xmlns="http://www.w3.org/1999/xhtml"
	xml:lang="en" lang="en"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>

</h:head>
<h:body>
	<ui:composition template="/protegido/main.xhtml">
		<ui:define name='conteudoPrincipal'>
			<h:outputScript>
				$(document).ready(function() {
					$("#navigation li").parent().find('li').removeClass("active");
					if ($("#navigation li .inicioAluno a")){
						$("#inicioAluno").addClass("active");
					}
				});
			</h:outputScript>
			<h2  style="margin-bottom: -5px; padding-bottom:0px;">Cursando Disciplinas</h2>
			<h:form prependId="false">
				<table border="0" cellpadding="0" cellspacing="0" width="100%"
					style="font-size: 12px;">

					<tbody>
						 <tr class="even">
							<th scope="col" style="max-width: 20%;">Nome</th>
							<th scope="col" style="max-width: 20%;">Horario</th>
							<th scope="col" style="max-width: 20%;">Local</th>
						</tr>
						<c:choose>
							<c:when
								test="#{usuarioMB.listarDisciplinasByAlunoId().size() > 0}">
								<c:forEach items="#{usuarioMB.listarDisciplinasByAlunoId()}"
									var="d">
									<tr>
										<td scope="col" style="max-width: 20%;">#{d.nome}</td>
										<td scope="col" style="max-width: 20%;">#{d.horario}</td>
										<td scope="col" style="max-width: 20%;">#{d.local}</td>
									</tr>
								</c:forEach>
							</c:when>
							<c:otherwise>
									<tr>
										<td scope="col" style="max-width: 20%;"> Aluno não está cursando disciplina alguma, atualmente.</td>
									</tr>
							</c:otherwise>
						</c:choose>
						<tr class="even">
							<th colspan="1" style="text-align: left;"></th>
							<th colspan="2" style="text-align: right;">#{usuarioMB.listarDisciplinasByAlunoId().size()}
								disciplina(s) encontrada(s).</th>
						</tr>
					</tbody>
				</table>
			</h:form>
			<br />
			<h2  style="margin-bottom: 0px; padding-bottom:0px;">Avisos</h2>
			<h:form prependId="false">
				<table border="0" cellpadding="0" cellspacing="0" width="100%"
					style="font-size: 12px;" id="listaNotificacoes">

					<tbody>
						<tr class="even">
							<th scope="col" style="max-width: 15%;">De</th>
							<th scope="col" style="max-width: 300px !important e;">Mensagem</th>
							<th scope="col" style="max-width: 15%;">Data Envio</th>
							<th scope="col" style="max-width: 5%;">Lida?</th>
							<th scope="col" style="max-width: 5%;">Ações</th>
						</tr>
						<c:choose>
							<c:when test="#{usuarioMB.notificacoesUsu.size() > 0}">
								<c:forEach items="#{usuarioMB.notificacoesUsu}" var="n">

									<tr>
										<td scope="col" style="max-width: 15%;">#{n.origem}</td>
										<td scope="col" style="max-width: 300px !important;">#{n.msg}</td>
										<td scope="col" style="max-width: 15%;">#{n.dtCad}</td>
										<td scope="col" style="max-width: 5%;"><h:outputText
												value="#{(n.lida) ? 'Sim' : 'Não'}" /></td>
										<c:if test="#{n.lida == 'false'}">
											<td scope="col" style="max-width: 5%;"><h:commandLink
													value=" " title="Marcar mensage como lida"
													styleClass="msgLida" action="#{usuarioMB.doMsgLida(n)}" /></td>
										</c:if>
										<c:if test="#{n.lida == 'true'}">
											<td scope="col" style="max-width: 5%;"><span
												class="msgLidaI"></span></td>
										</c:if>
									</tr>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<br />
								<tr>
									<td colspan="6">Nenhuma notificação encontrada.<br />

									</td>
								</tr>
							</c:otherwise>
						</c:choose>
						<tr class="even">
							<th colspan="3" style="text-align: left;"><small
								style="font-size: 0.8em;">Para marcar uma notificação
									como lida, clique em </small><span class="msgLidaI"></span></th>
							<th colspan="2" style="text-align: right;">#{usuarioMB.currUsuario.notificacoes.size()}
								notificação(ões) encontrada(s).</th>
						</tr>
					</tbody>
				</table>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>